let {src,dest,watch} = require('gulp'),
     sass = require('gulp-sass'),
	 cssnano =require('gulp-cssnano'),
	 rename = require('gulp-rename'),
	 uglify = require('gulp-uglify'),
	 htmlmin = require('gulp-htmlmin'),
	 imagemin = require('gulp-imagemin'),
	 babel = require('gulp-babel');
function fnCopyIndex(){
	return src('./src/index.html').pipe(dest('./dist/index.html'))
}
function fnCss(){
	return src('./src/css/*.css')
	.pipe(sass())
	.pipe(cssnano())
	.pipe(rename({suffix:'.min'}))
	.pipe(dest('./dist/css'));
}
function fnJS(){
	return src('./src/js/*.js')
	.pipe(babel({
		presets:['@babel/env']
	}))
	.pipe(uglify())
	.pipe(rename({suffix:'.min'}))
	.pipe(dest('./dist/js'));
}
function fnImg(){
	return src('./src/imgs/*')
	.pipe(imagemin())
	.pipe(dest('./dist/img'))
}
function fnWatch(){
	watch('./src/js/*.js',fnJS)
	watch('./src/css/*.css',fnCss)
	
}
exports.copyIndex =fnCopyIndex;
exports.css =fnCss;
exports.js =fnJS;	 
exports.img =fnImg;
exports.default =fnWatch;